package trading.algo;

import java.util.TimerTask;

import trading.bo.EmailAccessorBO;
import trading.bo.IBAccessorBO;

public class CancelOrderTask extends TimerTask {

    private IBAccessorBO ibAccessorBO;
    private EmailAccessorBO emailAccessorBO;
    private int orderId;

    public CancelOrderTask(IBAccessorBO ibAccessorBO,
            EmailAccessorBO emailAccessorBO, int orderId) {
        this.ibAccessorBO = ibAccessorBO;
        this.emailAccessorBO = emailAccessorBO;
        this.orderId = orderId;
    }

    @Override
    public void run() {
        this.ibAccessorBO.cancelOpenOrder(orderId);
        this.emailAccessorBO.sendCancelOrderEmail(orderId);
    }

}
